<!DOCTYPE html>
<html>
<head>
    <title>警员训练信息</title>
    {% include 'admin/common/header.html' %}
</head>
<body class="pear-container">
{# 查询表单 #}

{# 用户表格 #}
<div class="user-main user-collasped">
    <div class="layui-card">
        <div class="layui-card-body">
            <table id="emergy-list-table" lay-filter="emergy-list-table"></table>
        </div>
    </div>
</div>
</body>

<script type="text/html" id="emergency-createTime">
    {{ '  {{layui.util.toDateString(d.create_at,  "yyyy-MM-dd HH:mm:ss")}' |safe }}}
</script>

{#//创建查看详情按钮#}
<script type="text/html" id="dict-type-bar">
        <button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="details"><i
                class="pear-icon pear-icon-file"></i>
        </button>
</script>
{% include 'admin/common/footer.html' %}
<script>
  layui.use(['table', 'form', 'jquery', 'popup'], function () {
    let table = layui.table
    let form = layui.form
    let $ = layui.jquery
    let popup = layui.popup
    let typeCode

      let cols = [
          [
              {title: '演练名称', field: 'planName', align: 'center'},
              {title: '逃脱演练评估', field: 'fightEvaluate', align: 'center'},
              {title: '演练评估结果', field: 'cal_result', align: 'center'},
              {title: '演练开始时间', field: 'date', templet: '#emergency-createTime', align: 'center'},
              {title: '查看详情', toolbar: '#dict-type-bar', align: 'center', width: 180}
          ]
      ]

    table.render({
      elem: '#emergy-list-table',
      url: '/emergency_report/data/fight',
      page: true,
      cols: cols,
      skin: 'line',
      height: 'full-148',
      toolbar: '#dict-type-toolbar',
        text: { none: '暂无演练报告' },
      defaultToolbar: [{
        layEvent: 'refresh',
        icon: 'layui-icon-refresh',
      }, 'filter', 'print', 'exports']
    })



    window.refreshType = function () {
      table.reload('emergy-list-table')
    }

    table.on('tool(emergy-list-table)', function (obj) {

       if (obj.event === 'details') {
        window.detailsType(obj)
      }
    })

      window.detailsType = function (obj) {
          layer.open({
              type: 2,
              title: '展示详情',
              shade: 0.1,
              area: ['100%', '100%'],
              content: '/emergency_report/details/fight?' +
                  'id=' + obj.data['id'] + '&' +
                  'planName=' + obj.data['planName'] + '&' +
                  'fightNumber=' + obj.data['fightNumber'] + '&' +
                  'description=' + obj.data['description'] + '&' +
                  'time=' + obj.data['time'] + '&' +
                  'status=' + obj.data['Status'] + '&' +
                  'step=' + obj.data['step'] + '&' +
                  'fightEvaluate=' + obj.data['fightEvaluate'] + '&' +
                  'eventLevel=' + obj.data['eventLevel'] + '&' +
                  'planNumber=' + obj.data['planNumber'] + '&' +
                  'simulationNumber=' + obj.data['simulationNumber'] + '&' +
                  'work_score=' + obj.data['work_score'] + '&' +
                  'process_score=' + obj.data['process_score'] + '&' +
                  'staff_score=' + obj.data['staff_score'] + '&' +
                  'cal_result=' + obj.data['cal_result'] + '&' +
                  'date=' + obj.data['date']
          })
      }

    table.on('toolbar(emergy-list-table)', function (obj) {
      if (obj.event === 'refresh') {
        window.refreshData()
      }
    })

     form.on('submit(emergy-info-query)', function (data) {
      table.reload('emergy-list-table', { where: data.field })
      return false
    })




    window.refreshData = function () {
      table.reload('emergy-list-table')
    }
  })
</script>
</html>